<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>
		
	</title>
	<style type="text/css">
		*{
			margin: 0;
			padding: 0;
		}
		.box{
			width: 500px;
			height: 500px;
			background-color: pink;
			padding: 20px;
			border: 10px solid #000;
		}
	</style>
</head>
<body>
<div class="box"></div>
<script type="text/javascript">
	let div = document.querySelector('.box')

	//获取盒子宽高的方法
	// 不包括边框只包括文本内容宽度和内边距 
	console.log('div.clientWidth',div.clientHeight) //540
	console.log('div.clientWidth',div.clientHeight) //540

	// 边框+内边距+边框宽度
	console.log('div.offsetWidth',div.offsetWidth)
	console.log('div.offsetHeight',div.offsetHeight)

</script>
</body>
</html>